package cn.chinaunicom.service.utils;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.boot.logging.DeferredLog;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;

public class ConifgEnvPostProcessor implements EnvironmentPostProcessor, ApplicationListener<ApplicationEvent>, Ordered {

    private static final DeferredLog LOGGER = new DeferredLog();
    @Value("${vdns.addr}")
    private String CONF_PATH;
    @Override
    public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
        LOGGER.info("打印日志====" + CONF_PATH);
    }

    @Override
    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        LOGGER.replayTo(ConifgEnvPostProcessor.class);
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
